import React, { Component } from 'react'
import './index.less'
import { Table,Row,Col,Button} from 'antd';
import Http from '../../../../axios'

export default class PersonalWeekly extends Component {
  state = {
    userInfo: '',
    id:"",
    data:[],
    
  }
  componentWillMount(){
    const userId = this.props.location.state && this.props.location.state.id;
    console.log(userId)
    this.queryPersonal()
  }
  goBack=()=>{
    this.props.history.goBack();
  }
  queryPersonal(){
    Http.request({
      url: '/user/achievement/list/'+this.props.location.state.id,
      //url: '/user/achievement/list/',
      method: 'get',
    }).then((resData) => {
      this.setState({
        data:resData.data,
      })
    })
  }
  render() {
    
    const columns = [{
      title: '成就描述',
      dataIndex: 'name',
      key: 'name',
    }, {
      title: '获得成就时间',
      dataIndex: 'acquireTime',
      key: 'acquireTime',
    }];
    return (
      <div className="container">
          <Button type="primary" className="back" onClick={this.goBack}>返回</Button>
          <Row >
       
            <Col span={3}></Col>
            <Col className="content" span={18}>
            <Row className="sectionList">
              <Table columns={columns} dataSource={this.state.data} pagination={{defaultPageSize: 10, showSizeChanger: true}} />
            </Row>
          </Col>
          <Col span={3}></Col>
              
         </Row>
      </div>

      
    )
  }
}
